package cn.tedu.lianxi1;

import java.util.HashMap;

public class Text7 {
    public static void main(String[] args) {
        String s1 = "abc";
        String s2 = new String("abc");     System.out.println(s1==s2);
        String s3 = "你好吗";
        String s4 ="你";
        String s5 ="好吗";
        System.out.println(s3==(s4+s5));
        System.out.println("abcd".lastIndexOf("bc",1));
        String  str1="java";String  str2="java"; String
                str3=new  String("java"); StringBuffer
                str4=new  StringBuffer("java");
        System.out.println(str1==str2);
        HashMap map = new HashMap();
        map.put("name",null);
        map.put("name","xiyangyang");
        System.out.println(map.get("name"));
        int  a = 0;
        while ( a < 5 ) {
            switch(a){
                case 0 :
                case 3 :
                    a = a + 2;
                case 1 :
                case 2 :
                    a = a + 3;
                default :
                    a = a + 5;
            }
        }
        System.out.print ( a );
        int i = 10;
        while ( i > 0 ){
            i = i + 1;
            if ( i == 10){
                break;
            }
        }
        int[] a1 = {1,2,3,4,5};
        expand(a1);
        changeArray(a1);
        printArray(a1);
        String str="ABCDE";
        str.substring(3);
        str.concat("XYZ");
        System.out.print(str);
    }
    public static void expand(int[] a1){
        int[] newArray = new int[a1.length * 2];
        System.arraycopy(a1, 0, newArray, 0, a1.length);
        a1 = newArray;
    }
    public static void changeArray(int[] a1){
        a1[0] = 10;
    }
    public static void printArray(int[] a1){
        for(int i = 0; i<a1.length; i++){
            System.out.print(a1[i] + "\t");
        }
        System.out.println();
    }


}
